<template>
  <el-dialog
    class="dialog"
    :visible="_visible"
    :title="$t('greyList.faceRecordDetail')"
    width="600px"
    :before-close="handleClose"
    :modal="false"
  >
    <div class="snapDetail-body d-flex jc-center ai-center">
      <div class="img-box d-flex jc-between ai-center">
        <MyImage
          class="img-wrapper"
          :class="{ language, isalive: row.alive_type == 1 }"
          width="120px"
          height="120px"
          :src="row.snap_path"
        />
      </div>
      <div class="snapDetail-list">
        <div class="detail-title">
          <span>{{ $t("baseInfo") }}</span>
        </div>
        <div>
          <span>{{ $t("channelNumber") }}</span
          ><span>{{ row.channel }}</span>
        </div>
        <div>
          <span>{{ $t("channelName") }}</span
          ><span>{{ row.camera_name }}</span>
        </div>
        <div>
          <span>{{ $t("captureDate") }}</span
          ><span>{{ row.trigger }}</span>
        </div>
        <div>
          <div class="detail-title title-last">
            <span>{{ $t("attrInfo") }}</span>
          </div>
          <div>
            <span>{{ $t("bodyCode.st_age") }}</span>
            <span>{{
              row.face_attr.st_age_value &&
              Math.round(row.face_attr.st_age_value)
            }}</span>
          </div>
          <div>
            <span>{{ $t("bodyCode.gender_code") }}</span
            ><span v-if="row.face_attr.gender_code">
              {{ this.$t(`faceCode.${row.face_attr.gender_code}`) }}
            </span>
          </div>
          <div>
            <span>{{ $t("faceCode.mustache_style") }}</span
            ><span v-if="row.face_attr.mustache_style">
              {{ this.$t(`faceCode.${row.face_attr.mustache_style}`) }}
            </span>
          </div>
          <div>
            <span>{{ $t("face_glasses") }}</span
            ><span>
              {{ this.$t(`bodyCode.${row.face_attr.glass_style}`) }}
            </span>
          </div>
          <div>
            <span>{{ $t("faceCode.cap_style") }}</span
            ><span>
              {{ this.$t(`bodyCode.${row.face_attr.st_respirator}`) }}
            </span>
          </div>
        </div>
      </div>
    </div>
  </el-dialog>
</template>
<script>
import MyImage from "@/components/Image.vue";
export default {
  components: {
    MyImage,
  },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    row: {
      type: Object,
      default: () => {
        return { face_attr: {} };
      },
    },
  },
  computed: {
    language() {
      return this.$store.state.language;
    },
    _visible: {
      get() {
        return this.visible;
      },
      set(val) {
        this.$emit("update:visible", val);
      },
    },
  },
  methods: {
    handleClose(done) {
      this._visible = false;
      done();
    },
  },
};
</script>
<style lang="less" scoped>
.dialog {
  z-index: 9999;
  position: absolute !important;
  top: auto !important;
  left: auto !important;
  right: 0;
  bottom: 0;
  margin: 0;
  .snapDetail-body {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    .img-box {
      position: relative;
      .img-similarity {
        background-color: rgba(240, 79, 86, 1);
        border-radius: 13px;
        height: 26px;
        width: 52px;
        position: absolute;
        left: 50%;
        bottom: 0;
        transform: translateX(-50%);
        text-align: center;
        line-height: 26px;
        color: #fff;
        &.lib_type2 {
          background-color: #78d57d;
        }
        &.lib_type0 {
          background-color: #6d68d3;
        }
      }
      .img-wrapper {
        position: relative;
      }
      .isalive.zh-CN::after {
        content: "\975E\6D3B\4F53";
      }
      .isalive.zh-TW::after {
        content: "\975E\6D3B\9AD4";
      }
      .isalive.en-US::after {
        content: "non-living body";
      }
      .isalive:after {
        border: 2px solid rgba(255, 0, 0, 0.767);
        border-radius: 2px;
        color: rgba(247, 45, 10, 0.87);
        font-size: 14px;
        font-weight: bold;
        line-height: 1;
        opacity: 0.5;
        position: absolute;
        padding: 5px;
        display: inline-block;
        left: 50%;
        top: 70%;
        transform: translate(-50%, -50%) rotate(-5deg) scale(1.1);
      }
    }
  }
  // .snapDetail-image-div {
  //   width: 220px;
  //   height: 250px;
  //   flex-shrink: 0;
  //   margin-left: 12px;
  // }
  .snapDetail-list {
    text-align: left;
    margin-left: 15px;
    padding-left: 15px;
    border-left: 1px solid #d8d8e0;
    line-height: 24px;
    width: 340px;
    font-family: "Noto Sans CJK SC";
    font-size: 13px;
    div {
      width: 100%;
    }
    .title-last {
      margin-top: 10px;
    }
    .detail-title,
    & > div > .detail-title {
      font-size: 14px;
      color: #000;
      font-weight: bold;
      margin-bottom: 10px;
      border-bottom: 1px solid #d8d8e0;
      > span:nth-child(1) {
        background: #8e8e92;
        padding: 5px 10px;
        width: auto;
        display: initial;
      }
    }
    > div span:nth-child(1),
    .snapDetail .snapDetail-list > div > div span:nth-child(1) {
      width: 120px;
      color: #333;
      display: inline-block;
      font-weight: bold;
    }
  }
}
</style>
